package icraf.carbon.gui.chart;

import static icraf.carbon.gui.MenuFactory.MenuProperty.CHART_FONT;
import static icraf.carbon.gui.MenuFactory.MenuProperty.CHART_LINE;
import icraf.common.gui.MenuGenerator.IconModel;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class ThresholdSettingPanel extends JPanel{
	private static final long serialVersionUID = -4339756690912887507L;
	private FontChooser fontChooser;
	private ShapeSettingPanel horLineSettingPanel;
	private ShapeSettingPanel verLineSettingPanel;
	
	public ThresholdSettingPanel () {
		
		this.setLayout(new BorderLayout());
		fontChooser = new FontChooser();
		horLineSettingPanel = new ShapeSettingPanel(ShapeSettingPanel.LINE_SETTING);
		verLineSettingPanel = new ShapeSettingPanel(ShapeSettingPanel.LINE_SETTING);
		JPanel pLine = new JPanel(new GridLayout(2, 1));
		pLine.add(horLineSettingPanel);
		pLine.add(verLineSettingPanel);
		JTabbedPane tabPane = new JTabbedPane();
		tabPane.addTab(CHART_FONT.getLabel(), CHART_FONT.getIcon(IconModel.ICON16), fontChooser);
		tabPane.addTab(CHART_LINE.getLabel(), CHART_LINE.getIcon(IconModel.ICON16), pLine);
		
		this.add(tabPane);
	}
	
	public void setSettingHorizontalLine(LineFormat s) {
		horLineSettingPanel.setSetting(s);
	}
	
	public void setSettingVerticalLine(LineFormat s) {
		horLineSettingPanel.setSetting(s);
	}
	
	public void setSettingFont(Font f) {
		fontChooser.setSettingFont(f);
	}

	
	

//TODO: harusnya sama dengan setting axis aja!	
	public LineFormat getSettingAxis(LineFormat s) {
		s =  horLineSettingPanel.getSetting(s);
//		s.font =fontChooser.getFont();
//		s.fontColor = fontChooser.getSettingColor();
		return s;
	}
	
	
}